package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.vo.BasePageData;
import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.bean.vo.CatalogIndexVo;
import com.cskaoyan.bean.vo.CategoryInfoVo;
import com.cskaoyan.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: project2_market
 * @time: 2021/10/22
 * @author: yangshuai
 **/

@RequestMapping("wx/catalog")
@RestController
public class WxCatalogController {

    @Autowired
    CategoryService categoryService;

    /**
     * 查询商品类目，当前类别，当前类别的子类别
     */
    @RequestMapping("index")
    public BaseRespVo index(){

        CatalogIndexVo catalogIndexVo = categoryService.queryCatalogIndex();

        return BaseRespVo.ok(catalogIndexVo);
    }

    /**
     * 通过market_category表类目的id,查询商品当前类别，当前类别的子类别
     */
    @RequestMapping("current")
    public BaseRespVo current(Integer id){

        CatalogIndexVo catalogIndexVo = categoryService.queryCatalogCurrent(id);

        return BaseRespVo.ok(catalogIndexVo);
    }
}
